var _console = null;
function MyAlert(msg)
{
	if ((_console == null) || (_console.closed)) {
		_console = window.open("MyAlert", "MyAlert", "scrollbars,resizable,width=625,height=400");
		_console.document.open("text/plain");
	}
	
	_console.document.write(msg);
	//_console.document.close();
}

// 1k DHTML API - standards version
d=document;l=d.layers;op=navigator.userAgent.indexOf('Opera')!=-1;px='px';
function gE(e,f){if(l){f=(f)?f:self;var V=f.document.layers;if(V[e])return V[e];for(var W=0;W<V.length;)t=gE(e,V[W++]);return t;}if(d.all)return d.all[e];return d.getElementById(e);}
function sE(e){l?e.visibility='show':e.style.visibility='visible';}
function hE(e){l?e.visibility='hide':e.style.visibility='hidden';}
function gV(e){return (l?e.visibility:e.style.visibility);}
function sZ(e,z){l?e.zIndex=z:e.style.zIndex=z;}
function sX(e,x){l?e.left=x:op?e.style.pixelLeft=x:e.style.left=x+px;}
function sY(e,y){l?e.top=y:op?e.style.pixelTop=y:e.style.top=y+px;}
function sP(e,p){l?e.position=p:e.style.position=p;}
function gX(e){if(l)return e.left;if(d.all){var o=e.offsetLeft;while((e=e.offsetParent)!=null)o+=e.offsetLeft;return o;}return e.offsetLeft;}
function gY(e){if(l)return e.top;if(d.all){var o=e.offsetTop;while((e=e.offsetParent)!=null)o+=e.offsetTop;return o;}return e.offsetTop;}
function gW(e){if(l)return e.document.width;if(op)return e.style.pixelWidth;return e.offsetWidth;}
function gH(e){if(l)return e.document.height;if(op)return e.style.pixelHeight;return e.offsetHeight;}
function sW(e,w){l?e.clip.width=w:op?e.style.pixelWidth=w:e.style.width=w+px;}
function sH(e,h){l?e.clip.height=h:op?e.style.pixelHeight=h:e.style.height=h+px;}
function sC(e,t,r,b,x){l?(X=e.clip,X.top=t,X.right=r,X.bottom=b,X.left=x):e.style.clip='rect('+t+px+' '+r+px+' '+b+px+' '+x+px+')';}
function wH(e,h){if(l){Y=e.document;Y.open();Y.write(h);Y.close();}if(e.innerHTML)e.innerHTML=h;}
        
function Message(id, children)
{
	this.id = id;
	this.children = children;
	this.parent = null;
}
function SetMessageParent(message, parent)
{
	message.parent = parent;
}
function ToggleReply(parent)
{
	if(parent && parent.children)
	{
		for(i=0; i<parent.children.length; i++)
		{
			var child = parent.children[i];
			var targetObject = gE(child.id);
			if(targetObject)
			{
				if(gV(targetObject) == "hidden")
				{
					sE(targetObject);
					sP(targetObject, "relative");
					ReplaceImage("image_" + parent.id, "images/expand.gif");
				}
				else
				{
					hE(targetObject);
					sP(targetObject, "absolute");
					ReplaceImage("image_" + parent.id, "images/collapse.gif");
					if(parent.children)
						HideChildren(parent);
				}
			}
		}
	}
}
function ShowChildren(parent)
{
	if(parent && parent.children)
	{
		for(i=0; i<parent.children.length; i++)
		{
			var child = parent.children[i];
			var targetObject = gE(child.id);
			if(targetObject)
			{
					sE(targetObject);
					sP(targetObject, "relative");
					ReplaceImage("image_" + parent.id, "images/expand.gif");
			}
			if(child.children)
			{
				var savedI = i;
				ShowChildren(child);
				i = savedI;
			}
		}
	}
}
function HideChildren(parent)
{
	if(parent && parent.children)
	{
		for(i=0; i<parent.children.length; i++)
		{
			var child = parent.children[i];
			var targetObject = gE(child.id);
			if(targetObject)
			{
				hE(targetObject);
				sP(targetObject, "absolute");
				ReplaceImage("image_" + parent.id, "images/collapse.gif");
			}
			if(child.children)
			{
				var savedI = i;
				HideChildren(child);
				i = savedI;
			}
		}
	}
}
function ExpandParents(message)
{
	if(message.parent)
	{
		ShowChildren(message.parent);
		if(message.parent.parent)
			ExpandParents(message.parent);
	}
}
function ReplaceImage(targetId, newImage)
{
	var targetImg = gE(targetId);
	if(targetImg)
		targetImg.src = newImage;
}
